<?php 
defined('RUN_KATANA') or die('Restricted access');
require('objectAdmin/AdAdmin.php');
require('objectAdmin/AdTypeAdmin.php');
require('objectAdmin/AdCatAdmin.php');
require('objectAdmin/AdBrandAdmin.php');
require('objectAdmin/AdModelAdmin.php');
class AdvertiserAdmin
{
	public $Info;
	public $Error;
	public $JsActionRun;
	
	public function AdvertiserAdmin()
	{
		self::runPreActions();
		self::runPostActions();
	}
	
	public function runPreActions()
	{
		global $commander;
		global $adc;
		
		switch($commander->getList())
		{	
			case 'ad':
				$adc->setView('list');
				$ada = new AdAdmin();
				$ada->runPreActions();
				return;
			break;
			case 'type':
				$adc->setView('list');
				$ata = new AdTypeAdmin();
				$ata->runPreActions();
				return;
			break;
			case 'cat':
				$adc->setView('list');
				$aca = new AdCatAdmin();
				$aca->runPreActions();
				return;
			break;
			case 'adbrand':
				$adc->setView('list');
				$abr = new AdBrandAdmin();
				$abr->runPreActions();
				return;
			break;
			case 'model':
				$adc->setView('list');
				$ama = new AdModelAdmin();
				$ama->runPreActions();
				return;
			break;
		}
	}
	
	public function runPostActions()
	{
		global $db;
		global $commander;
		global $adc;
		
		switch($commander->getList())
		{	
			case 'ad':
				$adc->setView('list');
				$ada = new AdAdmin();
				$ada->runPostActions();
				return;
			break;
			case 'type':
				$adc->setView('list');
				$ata = new AdTypeAdmin();
				$ata->runPostActions();
				return;
			break;
			case 'cat':
				$adc->setView('list');
				$aca = new AdCatAdmin();
				$aca->runPostActions();
				return;
			break;
			case 'adbrand':
				$adc->setView('list');
				$abr = new AdBrandAdmin();
				$abr->runPostActions();
				return;
			break;
			case 'model':
				$adc->setView('list');
				$ama = new AdModelAdmin();
				$ama->runPostActions();
				return;
			break;
		}
		
		switch($commander->getEditor())
		{	
			case 'ad':
				$adc->setView('detail');
				$ada = new AdAdmin();
				$ada->runPostActions();
				return;
			break;
			case 'type':
				$adc->setView('detail');
				$ata = new AdTypeAdmin();
				$ata->runPostActions();
				return;
			break;
			case 'cat':
				$adc->setView('detail');
				$aca = new AdCatAdmin();
				$aca->runPostActions();
				return;
			break;
			case 'adbrand':
				$adc->setView('detail');
				$abr = new AdBrandAdmin();
				$abr->runPostActions();
				return;
			break;
			case 'model':
				$adc->setView('detail');
				$ama = new AdModelAdmin();
				$ama->runPostActions();
				return;
			break;
		}
	}
}
?>